package interfaceDemo;

public class Demo {
    public static void main(String[] args) {
       /* Dog d = new Dog();
        method01(d);*/
        method01(new Dog());//method01 (0x7c)

        System.out.println("---------");

        Swim swim = method02();  //  Swim swim=0x5b=new Dog();
        swim.swimming();
    }

    public static void method01(Swim s) {//Swim s=0x7c=new Dog();//父接口指向子类对象
        s.swimming();
    }

    public static Swim method02() {
   /*     Dog dog = new Dog();//Dog dog=0x5b

        return dog;//return 0x5b*/
        return new Dog();//更简单，使用匿名对象
    }
}
